3.1087 \(\int \frac{1}{(a+i a \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx\)

Optimal. Leaf size=174 \[ \frac{x \left (3 i c^2 d+c^3-3 c d^2+3 i d^3\right )}{4 a^2 (c-i d) (c+i d)^3}-\frac{d^3 \log (c \cos (e+f x)+d \sin (e+f x))}{a^2 f (c-i d) (c+i d)^3}+\frac{-3 d+i c}{4 a^2 f (c+i d)^2 (1+i \tan (e+f x))}-\frac{1}{4 f (-d+i c) (a+i a \tan (e+f x))^2} \]

[Out]

((c^3 + (3*I)*c^2*d - 3*c*d^2 + (3*I)*d^3)*x)/(4*a^2*(c - I*d)*(c + I*d)^3) - (d^3*Log[c*Cos[e + f*x] + d*Sin[
e + f*x]])/(a^2*(c - I*d)*(c + I*d)^3*f) + (I*c - 3*d)/(4*a^2*(c + I*d)^2*f*(1 + I*Tan[e + f*x])) - 1/(4*(I*c
- d)*f*(a + I*a*Tan[e + f*x])^2)

________________________________________________________________________________________

Rubi [A]  time = 0.411206, antiderivative size = 174, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {3559, 3596, 3531, 3530} \[ \frac{x \left (3 i c^2 d+c^3-3 c d^2+3 i d^3\right )}{4 a^2 (c-i d) (c+i d)^3}-\frac{d^3 \log (c \cos (e+f x)+d \sin (e+f x))}{a^2 f (c-i d) (c+i d)^3}+\frac{-3 d+i c}{4 a^2 f (c+i d)^2 (1+i \tan (e+f x))}-\frac{1}{4 f (-d+i c) (a+i a \tan (e+f x))^2} \]

Antiderivative was successfully verified.

[In]

Int[1/((a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])),x]

[Out]

((c^3 + (3*I)*c^2*d - 3*c*d^2 + (3*I)*d^3)*x)/(4*a^2*(c - I*d)*(c + I*d)^3) - (d^3*Log[c*Cos[e + f*x] + d*Sin[
e + f*x]])/(a^2*(c - I*d)*(c + I*d)^3*f) + (I*c - 3*d)/(4*a^2*(c + I*d)^2*f*(1 + I*Tan[e + f*x])) - 1/(4*(I*c
- d)*f*(a + I*a*Tan[e + f*x])^2)

Rule 3559

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Sim
p[(a*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^(n + 1))/(2*f*m*(b*c - a*d)), x] + Dist[1/(2*a*m*(b*c - a*d))
, Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Simp[b*c*m - a*d*(2*m + n + 1) + b*d*(m + n + 1)*Tan
[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2
+ d^2, 0] && LtQ[m, 0] && (IntegerQ[m] || IntegersQ[2*m, 2*n])

Rule 3596

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[((a*A + b*B)*(a + b*Tan[e + f*x])^m*(c + d*Tan[e + f*x])^(n + 1))/(2
*f*m*(b*c - a*d)), x] + Dist[1/(2*a*m*(b*c - a*d)), Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*Si
mp[A*(b*c*m - a*d*(2*m + n + 1)) + B*(a*c*m - b*d*(n + 1)) + d*(A*b - a*B)*(m + n + 1)*Tan[e + f*x], x], x], x
] /; FreeQ[{a, b, c, d, e, f, A, B, n}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0] &&  !GtQ[n,
0]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rubi steps

\begin{align*} \int \frac{1}{(a+i a \tan (e+f x))^2 (c+d \tan (e+f x))} \, dx &=-\frac{1}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac{\int \frac{-2 a (i c-2 d)-2 i a d \tan (e+f x)}{(a+i a \tan (e+f x)) (c+d \tan (e+f x))} \, dx}{4 a^2 (i c-d)}\\ &=\frac{i c-3 d}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac{1}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac{\int \frac{-2 a^2 \left (c^2+3 i c d-4 d^2\right )-2 a^2 (c+3 i d) d \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{8 a^4 (c+i d)^2}\\ &=\frac{\left (c^3+3 i c^2 d-3 c d^2+3 i d^3\right ) x}{4 a^2 (c+i d)^2 \left (c^2+d^2\right )}+\frac{i c-3 d}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac{1}{4 (i c-d) f (a+i a \tan (e+f x))^2}-\frac{d^3 \int \frac{d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{a^2 (c+i d)^2 \left (c^2+d^2\right )}\\ &=\frac{\left (c^3+3 i c^2 d-3 c d^2+3 i d^3\right ) x}{4 a^2 (c+i d)^2 \left (c^2+d^2\right )}-\frac{d^3 \log (c \cos (e+f x)+d \sin (e+f x))}{a^2 (c+i d)^2 \left (c^2+d^2\right ) f}+\frac{i c-3 d}{4 a^2 (c+i d)^2 f (1+i \tan (e+f x))}-\frac{1}{4 (i c-d) f (a+i a \tan (e+f x))^2}\\ \end{align*}

Mathematica [B]  time = 1.34975, size = 372, normalized size = 2.14 \[ -\frac{\sec ^2(e+f x) \left (16 d^3 (\sin (2 (e+f x))-i \cos (2 (e+f x))) \tan ^{-1}\left (\frac{\left (d^2-c^2\right ) \sin (f x)-2 c d \cos (f x)}{\left (c^2-d^2\right ) \cos (f x)-2 c d \sin (f x)}\right )+i c^2 d \sin (2 (e+f x))-12 c^2 d f x \sin (2 (e+f x))-8 c^2 d+4 i c^3 f x \sin (2 (e+f x))+c^3 \sin (2 (e+f x))+4 i c^3+c d^2 \sin (2 (e+f x))-12 i c d^2 f x \sin (2 (e+f x))+\cos (2 (e+f x)) \left (-8 d^3 \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )+(c+i d)^2 (4 c f x+i c+4 i d f x+d)\right )-8 i d^3 \sin (2 (e+f x)) \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )+4 i c d^2+i d^3 \sin (2 (e+f x))+4 d^3 f x \sin (2 (e+f x))-8 d^3\right )}{16 a^2 f (c-i d) (c+i d)^3 (\tan (e+f x)-i)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[1/((a + I*a*Tan[e + f*x])^2*(c + d*Tan[e + f*x])),x]

[Out]

-(Sec[e + f*x]^2*((4*I)*c^3 - 8*c^2*d + (4*I)*c*d^2 - 8*d^3 + Cos[2*(e + f*x)]*((c + I*d)^2*(I*c + d + 4*c*f*x
 + (4*I)*d*f*x) - 8*d^3*Log[(c*Cos[e + f*x] + d*Sin[e + f*x])^2]) + c^3*Sin[2*(e + f*x)] + I*c^2*d*Sin[2*(e +
f*x)] + c*d^2*Sin[2*(e + f*x)] + I*d^3*Sin[2*(e + f*x)] + (4*I)*c^3*f*x*Sin[2*(e + f*x)] - 12*c^2*d*f*x*Sin[2*
(e + f*x)] - (12*I)*c*d^2*f*x*Sin[2*(e + f*x)] + 4*d^3*f*x*Sin[2*(e + f*x)] - (8*I)*d^3*Log[(c*Cos[e + f*x] +
d*Sin[e + f*x])^2]*Sin[2*(e + f*x)] + 16*d^3*ArcTan[(-2*c*d*Cos[f*x] + (-c^2 + d^2)*Sin[f*x])/((c^2 - d^2)*Cos
[f*x] - 2*c*d*Sin[f*x])]*((-I)*Cos[2*(e + f*x)] + Sin[2*(e + f*x)])))/(16*a^2*(c - I*d)*(c + I*d)^3*f*(-I + Ta
n[e + f*x])^2)

________________________________________________________________________________________

Maple [B]  time = 0.05, size = 339, normalized size = 2. \begin{align*}{\frac{-{\frac{i}{8}}\ln \left ( \tan \left ( fx+e \right ) -i \right ){c}^{2}}{f{a}^{2} \left ( c+id \right ) ^{3}}}+{\frac{{\frac{7\,i}{8}}\ln \left ( \tan \left ( fx+e \right ) -i \right ){d}^{2}}{f{a}^{2} \left ( c+id \right ) ^{3}}}+{\frac{\ln \left ( \tan \left ( fx+e \right ) -i \right ) cd}{2\,f{a}^{2} \left ( c+id \right ) ^{3}}}+{\frac{icd}{f{a}^{2} \left ( c+id \right ) ^{3} \left ( \tan \left ( fx+e \right ) -i \right ) }}+{\frac{{c}^{2}}{4\,f{a}^{2} \left ( c+id \right ) ^{3} \left ( \tan \left ( fx+e \right ) -i \right ) }}-{\frac{3\,{d}^{2}}{4\,f{a}^{2} \left ( c+id \right ) ^{3} \left ( \tan \left ( fx+e \right ) -i \right ) }}-{\frac{{\frac{i}{4}}{c}^{2}}{f{a}^{2} \left ( c+id \right ) ^{3} \left ( \tan \left ( fx+e \right ) -i \right ) ^{2}}}+{\frac{{\frac{i}{4}}{d}^{2}}{f{a}^{2} \left ( c+id \right ) ^{3} \left ( \tan \left ( fx+e \right ) -i \right ) ^{2}}}+{\frac{cd}{2\,f{a}^{2} \left ( c+id \right ) ^{3} \left ( \tan \left ( fx+e \right ) -i \right ) ^{2}}}-{\frac{i\ln \left ( \tan \left ( fx+e \right ) +i \right ) }{f{a}^{2} \left ( 8\,id-8\,c \right ) }}+{\frac{{d}^{3}\ln \left ( c+d\tan \left ( fx+e \right ) \right ) }{f{a}^{2} \left ( id-c \right ) \left ( c+id \right ) ^{3}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e)),x)

[Out]

-1/8*I/f/a^2/(c+I*d)^3*ln(tan(f*x+e)-I)*c^2+7/8*I/f/a^2/(c+I*d)^3*ln(tan(f*x+e)-I)*d^2+1/2/f/a^2/(c+I*d)^3*ln(
tan(f*x+e)-I)*c*d+I/f/a^2/(c+I*d)^3/(tan(f*x+e)-I)*c*d+1/4/f/a^2/(c+I*d)^3/(tan(f*x+e)-I)*c^2-3/4/f/a^2/(c+I*d
)^3/(tan(f*x+e)-I)*d^2-1/4*I/f/a^2/(c+I*d)^3/(tan(f*x+e)-I)^2*c^2+1/4*I/f/a^2/(c+I*d)^3/(tan(f*x+e)-I)^2*d^2+1
/2/f/a^2/(c+I*d)^3/(tan(f*x+e)-I)^2*c*d-I/f/a^2/(8*I*d-8*c)*ln(tan(f*x+e)+I)+1/f/a^2*d^3/(I*d-c)/(c+I*d)^3*ln(
c+d*tan(f*x+e))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.67025, size = 455, normalized size = 2.61 \begin{align*} -\frac{{\left (16 \, d^{3} e^{\left (4 i \, f x + 4 i \, e\right )} \log \left (\frac{{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right ) -{\left (4 \, c^{3} + 12 i \, c^{2} d - 12 \, c d^{2} + 28 i \, d^{3}\right )} f x e^{\left (4 i \, f x + 4 i \, e\right )} - i \, c^{3} + c^{2} d - i \, c d^{2} + d^{3} +{\left (-4 i \, c^{3} + 8 \, c^{2} d - 4 i \, c d^{2} + 8 \, d^{3}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} e^{\left (-4 i \, f x - 4 i \, e\right )}}{{\left (16 \, a^{2} c^{4} + 32 i \, a^{2} c^{3} d + 32 i \, a^{2} c d^{3} - 16 \, a^{2} d^{4}\right )} f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

-(16*d^3*e^(4*I*f*x + 4*I*e)*log(((I*c + d)*e^(2*I*f*x + 2*I*e) + I*c - d)/(I*c + d)) - (4*c^3 + 12*I*c^2*d -
12*c*d^2 + 28*I*d^3)*f*x*e^(4*I*f*x + 4*I*e) - I*c^3 + c^2*d - I*c*d^2 + d^3 + (-4*I*c^3 + 8*c^2*d - 4*I*c*d^2
 + 8*d^3)*e^(2*I*f*x + 2*I*e))*e^(-4*I*f*x - 4*I*e)/((16*a^2*c^4 + 32*I*a^2*c^3*d + 32*I*a^2*c*d^3 - 16*a^2*d^
4)*f)

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))**2/(c+d*tan(f*x+e)),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [B]  time = 1.37076, size = 400, normalized size = 2.3 \begin{align*} -\frac{2 \,{\left (\frac{d^{4} \log \left (-i \, d \tan \left (f x + e\right ) - i \, c\right )}{2 \, a^{2} c^{4} d + 4 i \, a^{2} c^{3} d^{2} + 4 i \, a^{2} c d^{4} - 2 \, a^{2} d^{5}} + \frac{{\left (c^{2} + 4 i \, c d - 7 \, d^{2}\right )} \log \left (i \, \tan \left (f x + e\right ) + 1\right )}{-16 i \, a^{2} c^{3} + 48 \, a^{2} c^{2} d + 48 i \, a^{2} c d^{2} - 16 \, a^{2} d^{3}} - \frac{\log \left (\tan \left (f x + e\right ) + i\right )}{-16 i \, a^{2} c - 16 \, a^{2} d} - \frac{3 \, c^{2} \tan \left (f x + e\right )^{2} + 12 i \, c d \tan \left (f x + e\right )^{2} - 21 \, d^{2} \tan \left (f x + e\right )^{2} - 10 i \, c^{2} \tan \left (f x + e\right ) + 40 \, c d \tan \left (f x + e\right ) + 54 i \, d^{2} \tan \left (f x + e\right ) - 11 \, c^{2} - 36 i \, c d + 37 \, d^{2}}{{\left (-32 i \, a^{2} c^{3} + 96 \, a^{2} c^{2} d + 96 i \, a^{2} c d^{2} - 32 \, a^{2} d^{3}\right )}{\left (\tan \left (f x + e\right ) - i\right )}^{2}}\right )}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))^2/(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

-2*(d^4*log(-I*d*tan(f*x + e) - I*c)/(2*a^2*c^4*d + 4*I*a^2*c^3*d^2 + 4*I*a^2*c*d^4 - 2*a^2*d^5) + (c^2 + 4*I*
c*d - 7*d^2)*log(I*tan(f*x + e) + 1)/(-16*I*a^2*c^3 + 48*a^2*c^2*d + 48*I*a^2*c*d^2 - 16*a^2*d^3) - log(tan(f*
x + e) + I)/(-16*I*a^2*c - 16*a^2*d) - (3*c^2*tan(f*x + e)^2 + 12*I*c*d*tan(f*x + e)^2 - 21*d^2*tan(f*x + e)^2
 - 10*I*c^2*tan(f*x + e) + 40*c*d*tan(f*x + e) + 54*I*d^2*tan(f*x + e) - 11*c^2 - 36*I*c*d + 37*d^2)/((-32*I*a
^2*c^3 + 96*a^2*c^2*d + 96*I*a^2*c*d^2 - 32*a^2*d^3)*(tan(f*x + e) - I)^2))/f